<template>
  <div class="first-data">
    <el-card class="box-card">
      <div slot="header" class="clearfix bg-pure-dark">
        <el-row :gutter="10">
          <el-col :span="12">
            <div>今日注册首存数据</div>
          </el-col>
          <el-col :span="12" getter>
            <div>历史注册今日首存数据</div>
          </el-col>
        </el-row>
      </div>
      <div>
        <el-row :span="24" :gutter="10">
          <el-col :span="12">
            <el-row class="db-category-list">
              <template v-for="(item,index) in categoryList">
                <el-col class="db-category-item"
                        v-if="index<=3"
                        :span="item.span" :xs="item.span*2" :md="item.span"
                        :key="index">
                  <div class="card-name-out">
                    <div class="card-name">{{item.name}}</div>
                    <div class="card-data">{{item.data}}</div>
                  </div>
                </el-col>
              </template>
            </el-row>
          </el-col>
          <el-col :span="12">
            <el-row class="db-category-list">
              <template v-for="(item,index) in categoryList">
                <el-col class="db-category-item"
                        v-if="index>3"
                        :span="item.span"
                        :xs="item.span*2"
                        :md="item.span"
                        :key="index">
                  <div class="card-name-out">
                    <div class="card-name">{{item.name}}</div>
                    <div class="card-data">{{item.data}}</div>
                  </div>
                </el-col>
              </template>
            </el-row>
          </el-col>
        </el-row>
      </div>
    </el-card>
    <first-data :time="['', '']"></first-data>
  </div>
</template>


<script>
import { grid } from '@/build';
import firstData from '../detail/firstData';
import { getFirstDataDetailApi as listApi } from '@/services/api/operational';

export default {
  name: 'register-rate',
  mixins: [grid],
  components: {
    firstData,
  },
  data() {
    return {
      basicData: {},
    };
  },
  methods: {

  },
  computed: {
    categoryList() {
      const basic = this.basicData;
      return [
        {
          span: 6,
          name: '今日注册首存人数',
          data: basic.newRegFirstRechargeUser,
        },
        {
          span: 6,
          name: '今日注册首存金额',
          data: _.currency(basic.newRegFirstRechargeMoney),
        },
        {
          span: 6,
          name: '今日注册首次代充人数',
          data: basic.newRegFirstUpAmountUser,
        },
        {
          span: 6,
          name: '今日注册首次代充金额',
          data: _.currency(basic.newRegFirstUpAmountMoney),
        },
        {
          span: 6,
          name: '历史注册今日首存人数',
          data: basic.firstRechargeUser,
        },
        {
          span: 6,
          name: '历史注册今日首存金额',
          data: _.currency(basic.firstRechargeMoney),
        },
        {
          span: 6,
          name: '历史注册今日首次代充人数',
          data: basic.firstUpAmountUser,
        },
        {
          span: 6,
          name: '历史注册今日首次代充金额',
          data: _.currency(basic.firstUpAmountMoney),
        },
      ];
    },
  },
  mounted() {
    this.bindGet(listApi, 'basicData', {
      action: 'getGrid',
      sendingData: 'filters',
    });
    this.getAll();
  },

};
</script>

<style lang="scss" scoped>
  $border-color-1: #DCDFE6;

  .box-card {
    width: 100%;
    margin: 10px 0;
  }

  .height-300 {
    height: 300px;
  }

  .db-category-list {
    border: 1px solid $border-color-1;
    overflow: hidden;
    /*margin-right: 20px;*/
    /*display: flex;*/
  }

  .m-l-20 {
    margin-left: 20px;
  }

  .m-r-20 {
    margin-right: 20px;
  }

  .m-l-10 {
    margin-left: 10px;
  }

  .m-r-10 {
    margin-right: 10px;
  }

  .db-category-item {
    height: 100px;
    padding: 10px;
    border-right: 1px solid $border-color-1;
    line-height: 16px;
    cursor: pointer;

    &:last-child {
      border-right: 0;
    }

    display: flex;
    flex-flow: column;
    justify-content: center;
    align-items: center;

    &.active {
      background: #e7e7e7;
      /*color: #fff;*/
    }

    > div {
      width: 100%;
      height: 100%;
    }
  }
  .card-name-out{
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .card-name {
    height: 40px;
    text-align: center;
    flex: 0 1 50%;
    /*white-space: nowrap;*/
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .card-data {
    height: 25px;
    text-align: center;
    flex: 0 1 25%;
  }
  .game-sum {
    .el-button--text {
      color: #909399;

      &.active {
        color: #409EFF
      }
    }
  }
  .first-data /deep/ .el-card__header{
    border-bottom: none;
    padding: 20px;
  }
</style>
